<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>电梯注册审核</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel="stylesheet" type="text/css" href="../../css/style.css">
	<script type="text/javascript" src="../../js/jquery-1.8.2.js"></script>
	<script type="text/javascript" src="../../js/dialog/jquery.artDialog.source.js?skin=default"></script>
	<script type="text/javascript" src="../../js/dialog/plugins/iframeTools.source.js"></script>
	<script type="text/javascript" src="../../js/datepicker/WdatePicker.js"></script>
	<script type="text/javascript" src="../../js/jquery.ztree.all-3.5.min.js"></script>
	<script type="text/javascript" src="../../js/jquery.form.js"></script>
	<script type="text/javascript" src="../../js/jquery.page.js"></script>
	<script type="text/javascript" src="../../js/base.js"></script>
	<script type="text/javascript">
	$(function(){
		$('select[name=energyStatus]').selectload('../../common/code.action','code','codedesc',{codepid:'23'});
		$('select[name=eleBasicStyle]').selectload('../../common/code.action','code','codedesc',{codepid:'39'});
		$('select[name=eleBasicTrade]').selectload('../../common/eletm_select.action','eleTradeCode','eleTradeName');
		$('select[name=adminCode]').selectload('../../common/adminunit_select.action','adminCode','adminName');
		$('select[name=propertyCode]').selectload('../../common/propertyunit_select.action','propertyCode','propertyName');
		$('select[name=serviceCode]').selectload('../../common/serviceunit_select.action','serviceCode','serviceName');
		$('select[name=adminCode]').selectload('../../common/adminunit_select.action','adminCode','adminName');
		$('select[name=pact]').selectload('../../common/code.action','code','codedesc',{codepid:'53'});
		//区域树
		$.fn.zTree.init($('#areaTree'),{
			data: {
				key:{
					name:'areaname'
				},
				simpleData: {
					enable: true,
					idKey:'areacode',
					pIdKey:'parentcode',
					rootPId:0
				}
			},
			async: {
				enable: true,
				url:"../../common/area_tree.action",
				autoParam:["areacode"]
			},
			callback:{
				onClick:function(e,id,node){
					if(node.isParent == false){
						$('input[name=areaName]').val(node.areacode);
						var $areaTree = $('.areaTree');
						var areaArr = new Array();
						areaArr.unshift(node.areaname);
						while(node.parentcode > 0){
							node = node.getParentNode();
							areaArr.unshift(node.areaname);
						}
						$('input[name=areaNameN]').val(areaArr.join(' > '));
						$areaTree.hide();
					}
				}
			}
		});
		$('input[name=areaNameN]').click(function(){
			$this = $(this);
			$hidden = $('input[name=areaName]');
			$areaTree = $('.areaTree');
			$this.val('');
			$hidden.val('');
			var os = $this.offset();
			$areaTree.css({left:os.left,top:os.top+($this.outerHeight(true)-1)});
			$areaTree.show();
		});
		$(document).mouseup(function(e){
			var $target = $(e.target);
			if(!$target.is('.areaTree')){
				if($target.parents('.areaTree').length == 0){
					$('.areaTree').hide();
				}
			}
		});
		//区域树结束
		//列表
		$('#list').page({
			url:'dtzcsh_search.action',
			config:'pageinfo,record,first,last,next,prev,jump',
			items:[{
				title:'电梯号码',
				name:'eleCode'
			},{
				title:'电梯名称',
				name:'eleName'
			},{
				title:'电梯类型',
				name:'eleBasicStyleText'
			},{
				title:'电梯总楼层',
				name:'eleFloor'
			},{
				title:'安装时间',
				name:'eleSetDate'
			},{
				title:'详情',
				render:function(row){
					$a = $('<a href="javascript:void(0)")">【详细】</a>');
					$a.click(function(){
						view(row);
					});
					return $a;
				}
			}]
		});

		$(document.search).ajaxForm({
			beforeSubmit:function(formData){
				var param = $(formData).formParam();
				$('#list').page('param',param);
				$('#list').page('show');
				return false;
			}
		});

		$('#updForm').ajaxForm({
			success:function(data){
				$('#list').data('checked').length = 0;
				$('#list').page('show');
			}
		});
		/*
		$('#btn_upd1').click(function(){
			var ids = $('#list').data('checked');
			if(ids.length < 1){
				$.dialog.alert('请选择要审核的注册电梯。');
			}else{
				upd(ids.join(','),$(this).attr('checkStatus'));
			}
		});
		$('#btn_del').click(function(){
			var ids = $('#list').data('checked');
			if(ids.length != 1){
				$.dialog.alert('只能对一部注册电梯进行不通过审核。');
			}else{
				del(ids.join(','));
			}
		});
		*/
	});
	var view = function(row){
		$.dialog({
			id:'viewdialog',
			title:'注册电梯详细',
			lock:true,
			width:'100%',
			height:'100%',
			content:document.getElementById('view'),
			button:[{
				name:'通过',
				focus: true,
				callback:function(){
					upd(row.eleBasicId,1);
					return false;
				}
			},{
				name:'不通过',
				callback:function(){
					del(row.eleBasicId);
					return false;
				}
			}]
		});
		$('#saveFrom').json2form(row);
	}
	var upd = function(ids,checkStatus){
		//$.dialog.confirm(document.getElementById('tgsim'),function(){
			//var input = this.DOM.content.find('input')[0];
			//var select = this.DOM.content.find('select')[0];
			var para = {
				ids:ids,
				checkStatus:checkStatus
			}
			$.post('dtzcsh_save.action',para,function(data){
				if($.dialog.list['viewdialog'] != undefined){
					$.dialog.list['viewdialog'].close();
				}
				$('#list').data('checked').length = 0;
				$('#list').page('show');
			});
		//});
	}
	var del = function(ids){
		$.dialog.prompt('请输入不予通过审核此注册电梯的理由',function(val){
			$.post('dtzcsh_del.action',{ids:ids,reason:val},function(data){
				if($.dialog.list['viewdialog'] != undefined){
					$.dialog.list['viewdialog'].close();
				}
				$('#list').data('checked').length = 0;
				$('#list').page('show');
			},'json');
		});
	}
	</script>
</head>
<body class="app">
	<h3>电梯注册审核</h3>
	<form class="search" name="search">
		<div class="tbdiv">
		<table>
			<tr>
				<th width="100">行政监管单位：</th>
				<td width="100"><select name="adminCode"></select></td>
				<th width="100">物业公司：</th>
				<td width="100"><select name="propertyCode"></select></td>
				<th width="100">维保单位：</th>
				<td><select name="serviceCode"></select></td>
			</tr>
			<tr>
				<th width="100">电梯名称：</th>
				<td width="100"><input type="text" class="inputText" name="eleName" value="" style="width:100px;"/></td>
				<th width="100">电梯编号：</th>
				<td colspan="3"><input type="text" class="inputText" name="eleCode" value="" style="width:100px;"/></td>
			</tr>
			<tr>
				<td colspan="6">
					<table>
						<tr>
							<th width="99">所属区域：</th>
							<td>
								<input type="hidden" name="areaName" value=""/>
								<input type="text" class="inputText" name="areaNameN" value="" style="width:347px;*width:348px;cursor:pointer;" readonly="readonly" />
							</td>
							<td><input type="submit" value="查询" class="inputButton"/></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		</div>
	</form>
	<div id="list"></div>
	<!-- 
	<div class="optionlink">
		<span id="btn_upd1" checkStatus="1">【通过】</span>
		<span id="btn_del" >【不通过】</span>
	</div>
	 -->
	<div class="areaTree"><div id="areaTree" class="ztree"></div></div>
	<div id="view" style="width:650px;display:none;">
		<form name="saveFrom" id="saveFrom" action="jbxxwh_save.action" method="post">
		<input type="hidden" name="eleBasicId" />
		<dl class="view">
			<dt>电梯号码：</dt>
			<dd><label name="eleCode"></label></dd>
			<dt>电梯名称：</dt>
			<dd><label name="eleName"></label></dd>
			<dt>注册代码：</dt>
			<dd><label name="eleBasicRegNum"></label></dd>
			<dt>电梯型号：</dt>
			<dd><label name="eleBasicType"></label></dd>
			<dt>电梯类型：</dt>
			<dd><label name="eleBasicStyleText"></label></dd>
			<dt>电梯品牌：</dt>
			<dd><label name="eleBasicTradeText"></label></dd>
			<dt>出场日期：</dt>
			<dd><label name="leaveFactoryDate" ></label></dd>
			<dt>额定速度：</dt>
			<dd><label name="ratingRate" ></label></dd>
			<dt>额定载重：</dt>
			<dd><label name="ratingLoad" ></label></dd>
			<dt>曳引机：</dt>
			<dd><label name="towEngine"></label></dd>
			<dt>控制系统：</dt>
			<dd><label name="controlSystem"></label></dd>
			<dt>变频器：</dt>
			<dd><label name="freConversion"></label></dd>
			<dt>安全钳：</dt>
			<dd><label name="safetyClamp"></label></dd>
			<dt>限速器：</dt>
			<dd><label name="limitToImplement"></label></dd>
			<dt>限速器直径：</dt>
			<dd><label name="limitToImpDia"></label></dd>
			<dt>制造单位：</dt>
			<dd><label name="produceUnit"></label></dd>
			<dt>安装时间：</dt>
			<dd><label name="eleSetDate"></label></dd>
			<dt>是否节能：</dt>
			<dd><label name="energyStatusText"></label></dd>
			<dt>电梯顶层：</dt>
			<dd><label name="eleTopFloor"></label></dd>
			<dt>电梯底层：</dt>
			<dd><label name="eleGroundFloor" ></label></dd>
			<dt>电梯基准楼层：</dt>
			<dd><label name="eleBasicFloor"></label></dd>
			<dt>电梯总楼层：</dt>
			<dd><label name="eleFloor"></label></dd>
			<dt>电梯额定运行次数：</dt>
			<dd><label name="eleSumTime"></label></dd>
			<dt>电梯初始运行次数：</dt>
			<dd><label name="eleCirculateTime"></label></dd>
			<dt>门机额定运行次数：</dt>
			<dd><label name="doorSumTime"></label></dd>
			<dt>门机初始运行次数：</dt>
			<dd><label name="doorCirculateTime"></label></dd>
			<dt>制动器额定运行次数：</dt>
			<dd><label name="detentSumTime" ></label></dd>
			<dt>制动器初始运行次数：</dt>
			<dd><label name="detentCirculateTime"></label></dd>
			<dt>主接触器额定运行次数：</dt>
			<dd><label name="mainContactSumTime"></label></dd>
			<dt>主接触器初始运行次数：</dt>
			<dd><label name="mainContactCirTime"></label></dd>
			<dt>辅助接触器额定运行次数：</dt>
			<dd><label name="runContactSumTime" ></label></dd>
			<dt>辅助接触器初始运行次数：</dt>
			<dd><label name="runContactCirTime" ></label></dd>
			<dt>钢丝绳额定折弯次数：</dt>
			<dd><label name="wireBendSumTime" ></label></dd>
			<dt>钢丝绳初始折弯次数：</dt>
			<dd><label name="wireBendCirTime" ></label></dd>
			<dt>电梯经度：</dt>
			<dd><label name="eleLongitude"></label></dd>
			<dt>电梯纬度：</dt>
			<dd><label name="eleLatitude"></label></dd>
			<div class="cl"></div>
		</dl>
		</form>
	</div>
	<div id="tgsim" style="display:none">
	<form name="tgform">
		<p style="margin-bottom:3px;">SIM卡：<input type="text" class="inputText" style="width:120px" name="simCard" /></p>
		<p>协 议：<select name="pact" class="inputText" style="width:128px;padding:2px;"></select></p>
	</form>
	</div>
</body>
</html>
